package com.gxa.dr2.config;

import com.gxa.dr2.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置类
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器
        registry.addInterceptor(new LoginInterceptor())
                // 拦截的操作
                .addPathPatterns("/**")
                // 放行的方法
                .excludePathPatterns("/login/**")
                // 放行静态资源
                .excludePathPatterns("/css/**","/fonts/**","/images/**","/js/**","/lib/**");
    }
}
